package com.travel.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.travel.entity.TbAir;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface AirMapper extends BaseMapper<TbAir>{

    @Select("SELECT * FROM tb_air WHERE air_stime=#{time}")
    @Results(value = {
            @Result(id = true,column = "air_id",property = "airId"),
            @Result(column = "air_saddr",property = "airSaddr"),
            @Result(column = "air_eaddr",property = "airEaddr"),
            @Result(column = "air_space",property = "airSpace"),
            @Result(column = "air_price",property = "airPrice"),
            @Result(column = "air_status",property = "airStatus"),
            @Result(column = "air_stime",property = "airStime"),
            @Result(column = "air_etime",property = "airEtime"),
            @Result(column = "air_number",property = "airNumber"),
            @Result(column = "ari_name",property = "ariName"),
    })
    List<TbAir> selectBytime(@Param("time") String time);


    @Select("SELECT * FROM tb_air WHERE air_saddr=#{addr}")
    @Results(value = {
            @Result(id = true,column = "air_id",property = "airId"),
            @Result(column = "air_saddr",property = "airSaddr"),
            @Result(column = "air_eaddr",property = "airEaddr"),
            @Result(column = "air_space",property = "airSpace"),
            @Result(column = "air_price",property = "airPrice"),
            @Result(column = "air_status",property = "airStatus"),
            @Result(column = "air_stime",property = "airStime"),
            @Result(column = "air_etime",property = "airEtime"),
            @Result(column = "air_number",property = "airNumber"),
            @Result(column = "ari_name",property = "ariName"),
    })
    List<TbAir> selectByaddr(@Param("addr")  String addr);

    @Select("SELECT * FROM tb_air WHERE air_saddr=#{saddr} and air_eaddr=#{eaddr}")
    @Results(value = {
            @Result(id = true,column = "air_id",property = "airId"),
            @Result(column = "air_saddr",property = "airSaddr"),
            @Result(column = "air_eaddr",property = "airEaddr"),
            @Result(column = "air_space",property = "airSpace"),
            @Result(column = "air_price",property = "airPrice"),
            @Result(column = "air_status",property = "airStatus"),
            @Result(column = "air_stime",property = "airStime"),
            @Result(column = "air_etime",property = "airEtime"),
            @Result(column = "air_number",property = "airNumber"),
            @Result(column = "ari_name",property = "ariName"),
    })
    List<TbAir> selectByaddress(@Param("saddr") String saddr, @Param("eaddr") String eaddr);


    @Select("SELECT * FROM tb_air WHERE air_saddr=#{saddr} and air_eaddr=#{eaddr} and air_stime=#{time}")
    @Results(value = {
            @Result(id = true,column = "air_id",property = "airId"),
            @Result(column = "air_saddr",property = "airSaddr"),
            @Result(column = "air_eaddr",property = "airEaddr"),
            @Result(column = "air_space",property = "airSpace"),
            @Result(column = "air_price",property = "airPrice"),
            @Result(column = "air_status",property = "airStatus"),
            @Result(column = "air_stime",property = "airStime"),
            @Result(column = "air_etime",property = "airEtime"),
            @Result(column = "air_number",property = "airNumber"),
            @Result(column = "ari_name",property = "ariName"),
    })
    List<TbAir> selectByaddBytime(@Param("saddr") String saddr, @Param("eaddr") String eaddr, @Param("time")String time);
}
